package viroyal.com.base.activity.engineering;

import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.suntiago.baseui.activity.base.AppDelegateBase;

import viroyal.com.base.R;
import viroyal.com.base.net.rsp.GetDeviceInfoResponseS;
import viroyal.com.dev.splash.ConfigDevice;

/**
 * author : gaochao
 * date   : 2020/3/10
 * desc   :
 */
public class DeviceInfoDelegate extends AppDelegateBase<DeviceInfoModel> {
  @Override
  public int getRootLayoutId() {
    return R.layout.activity_device_info_activity;
  }

  @Override
  public void initWidget() {

  }

  public void deviceInfo(GetDeviceInfoResponseS.DeviceInfoForPhp extra) {
    TextView tvImei = get(R.id.tv_device_imei);
    TextView textView = get(R.id.tv_device_name);
    TextView tvSchool = get(R.id.tv_device_school);
    if (!TextUtils.isEmpty(extra.device_name)) {
      textView.setText(extra.device_name);
    }
    if (!TextUtils.isEmpty(extra.school_name)) {
      tvSchool.setText(extra.school_name);

    }
    tvImei.setText(ConfigDevice.getDeviceId());

  }

  public void initView() {
    ImageView ivBack = get(R.id.ic_back);
    ivBack.setOnClickListener(view -> getActivity().finish());
  }
}
